class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     * 求最小差值
     * @param a int整型vector 数组a
     * @return int整型
     */
    int minDifference(vector<int>& a) {
        sort(a.begin(), a.end());
        long long res = INT_MAX, n = a.size();
        for(int i = 0; i < n - 1; ++i)
        {
            res = min(res, (long long)abs(a[i + 1] - a[i]));
        }
        return res;
    }
};